#include <iostream>
using namespace std;
int full_min(int* number,int length)
{
    int min_value = number[0];
    for(int i=1;i<length;i++)
    {
        if(number[i]<=min_value)
            min_value = number[i];
    }
    return min_value;
}
int Min(int* number,int length)
{
    int i=0,j=length-1;
    int index_mid = 0;
    while(number[i]>=number[j])
    {
        if(j-i == 1)
        {
            index_mid = j;
            break;
        }
        index_mid = (i+j)/2;
        if(number[i]<=number[index_mid])
            i = index_mid;
        else if(number[j]>=number[index_mid])
            j = index_mid;
        if(number[i] == number[index_mid]&&number[j] == number[index_mid])
            return full_min(number,length);
    }
    return number[index_mid];
}
int main() {
    int a[] = {0,1,1,1,1};
    cout<<Min(a,5);
    return 0;
}